#include <stdio.h>
#include <stdarg.h>

double avg(int num, ...){
    va_list args;
    va_start(args, num);
    double sum = 0;
    for (int i = 0; i < num; i++) {
        sum += va_arg(args, double);
    }
    va_end(args);
    return sum / (double)num;
}

int main() {
    double a, b, c, d, e;
    scanf("%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e);
    double result = avg(2, a, b) - avg(3, c, d, e);
    printf("%.4lf", result);
    return 0;
}